﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using Intelligent.OTC.Common.UnitOfWork;
using Intelligent.OTC.Business;
using Intelligent.OTC.Common;
using System.Configuration;
using System.IO;
using Intelligent.OTC.Common.Utils;
using Intelligent.OTC.WebApi.Core;
using Intelligent.OTC.Common.Exceptions;
using Intelligent.OTC.Domain.DataModel;
using System.Net.Http;
using System.Net;
using Intelligent.OTC.Common.Attr;
using System.Web.OData.Query;
using System.Web.OData.Extensions;
using Intelligent.OTC.Domain.Dtos;

namespace Intelligent.OTC.WebApi.Controllers
{
    [UserAuthorizeFilter(actionSet: "myinvoices")]
    public class MyinvoicesController : ApiController
    {
        [HttpGet]
        [PagingQueryable]
        public IEnumerable<MyinvoicesDto> Get(string closeType = "")
        {
            MyinvoicesService service = SpringFactory.GetObjectImpl<MyinvoicesService>("MyinvoicesService");
            return service.GetMyinvoicesList(closeType);
        }

        [HttpGet]
        public HttpResponseMessage ExpoertInvoiceList(string cCode, string cName, string bCode, string bName,
                                                      string iNum, string pNum, string sNum, string rbo, string cTerm,
                                                      string close,string legal,string doc, string state,string tstate,
                                                      string memo,string oper,string pdf,string pdt,string idf,string idt, string ddf,string ddt)
        {
            MyinvoicesService service = SpringFactory.GetObjectImpl<MyinvoicesService>("MyinvoicesService");
            return service.ExportInvoicesList(cCode, cName, bCode, bName, iNum, pNum, sNum, rbo, cTerm,
                                              close, legal, doc, state, tstate, memo, oper, pdf, pdt, idf, idt, ddf, ddt);
        }

    }
}